package com.ty.day2;

import java.util.Arrays;
import java.util.Scanner;

/**
 * Created by IntelliJ IDEA.
 *
 * @author : txy
 * @create 2023/11/7 19:23
 */
public class Task3 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int x,count=0;//x输入的数，count计数器等于5退出
        char[] a=new char[5];//存放对应的字符
        int[] b =new int[5];//存放输入数据
        System.out.println("请输入5个100以内的数字：");
        while (true){
            x=sc.nextInt();
            if (x>100||x<0){
                System.out.println(x+"不符合要求，重新输入一个：");
                continue;
            }
            //给对应位置赋值
            b[count]=x;
            a[count]= (char) x;
            //计数加1
            count++;
            if (count==5){//数据输入完成，退出
                break;
            }
        }
        for (int i = 0; i < a.length; i++) {
            System.out.println(b[i]+" ---- "+a[i]);
        }

    }
}
